/*
 Navicat Premium Data Transfer

 Source Server         : 本地连接
 Source Server Type    : MySQL
 Source Server Version : 50726
 Source Host           : 127.0.0.1:3306
 Source Schema         : jdbc-realm

 Target Server Type    : MySQL
 Target Server Version : 50726
 File Encoding         : 65001

 Date: 24/02/2020 02:46:43
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for roles_permissions
-- ----------------------------
DROP TABLE IF EXISTS `roles_permissions`;
CREATE TABLE `roles_permissions` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '权限ID',
  `role_name` varchar(100) NOT NULL COMMENT '角色名',
  `permission` varchar(100) NOT NULL COMMENT '权限',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_roles_permissions` (`role_name`,`permission`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COMMENT='角色-权限表';

-- ----------------------------
-- Records of roles_permissions
-- ----------------------------
BEGIN;
INSERT INTO `roles_permissions` VALUES (15, 'admin', 'data:select');
INSERT INTO `roles_permissions` VALUES (1, 'admin', 'user:add');
INSERT INTO `roles_permissions` VALUES (2, 'admin', 'user:delete');
INSERT INTO `roles_permissions` VALUES (4, 'admin', 'user:select');
INSERT INTO `roles_permissions` VALUES (3, 'admin', 'user:update');
INSERT INTO `roles_permissions` VALUES (10, 'superadmin', 'admin:add');
INSERT INTO `roles_permissions` VALUES (11, 'superadmin', 'admin:delete');
INSERT INTO `roles_permissions` VALUES (13, 'superadmin', 'admin:select');
INSERT INTO `roles_permissions` VALUES (12, 'superadmin', 'admin:update');
INSERT INTO `roles_permissions` VALUES (14, 'superadmin', 'data:select');
INSERT INTO `roles_permissions` VALUES (6, 'superadmin', 'user:add');
INSERT INTO `roles_permissions` VALUES (7, 'superadmin', 'user:delete');
INSERT INTO `roles_permissions` VALUES (9, 'superadmin', 'user:select');
INSERT INTO `roles_permissions` VALUES (8, 'superadmin', 'user:update');
INSERT INTO `roles_permissions` VALUES (5, 'user', 'data:select');
COMMIT;

-- ----------------------------
-- Table structure for t_roles_permissions
-- ----------------------------
DROP TABLE IF EXISTS `t_roles_permissions`;
CREATE TABLE `t_roles_permissions` (
  `pid` varchar(32) NOT NULL COMMENT '权限ID',
  `role_name` varchar(32) NOT NULL COMMENT '角色名称',
  `permission` varchar(100) NOT NULL COMMENT '权限',
  PRIMARY KEY (`pid`),
  UNIQUE KEY `t_roles_permissions_pid_uindex` (`pid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义的角色-权限表';

-- ----------------------------
-- Records of t_roles_permissions
-- ----------------------------
BEGIN;
INSERT INTO `t_roles_permissions` VALUES ('6772f90137804981919b791641c5cd82', 'admin', 'user:delete');
INSERT INTO `t_roles_permissions` VALUES ('7efd0334f028460886f8b7aa0b292daf', 'admin', 'user:add');
INSERT INTO `t_roles_permissions` VALUES ('9f7e27f39fd146138db9e54263699990', 'admin', 'user:update');
INSERT INTO `t_roles_permissions` VALUES ('c6e867d063a14d1fb454f7fff1aff4be', 'admin', 'user:select');
COMMIT;

-- ----------------------------
-- Table structure for t_user_roles
-- ----------------------------
DROP TABLE IF EXISTS `t_user_roles`;
CREATE TABLE `t_user_roles` (
  `rid` varchar(32) NOT NULL COMMENT '角色ID',
  `user_name` varchar(16) NOT NULL COMMENT '用户名',
  `role_name` varchar(32) NOT NULL COMMENT '角色名',
  PRIMARY KEY (`rid`),
  UNIQUE KEY `t_user_roles_rid_uindex` (`rid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义的用户-角色表';

-- ----------------------------
-- Records of t_user_roles
-- ----------------------------
BEGIN;
INSERT INTO `t_user_roles` VALUES ('78b9ab2364374cfd90ddfee520500584', 'tool323', 'user');
INSERT INTO `t_user_roles` VALUES ('c59a20e08386461cb4bd82328fd16057', 'tool323', 'admin');
COMMIT;

-- ----------------------------
-- Table structure for t_users
-- ----------------------------
DROP TABLE IF EXISTS `t_users`;
CREATE TABLE `t_users` (
  `uid` varchar(32) NOT NULL COMMENT '用户ID',
  `user_name` varchar(16) NOT NULL COMMENT '用户名',
  `passwd` varchar(32) NOT NULL COMMENT '密码',
  `passwd_salt` varchar(100) DEFAULT NULL COMMENT '密码加密的盐',
  PRIMARY KEY (`uid`),
  UNIQUE KEY `t_users_user_name_uindex` (`user_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义的用户表';

-- ----------------------------
-- Records of t_users
-- ----------------------------
BEGIN;
INSERT INTO `t_users` VALUES ('9c5ccd472bcb4fbd80e92d5b41341339', 'tool323', 'Txca8^&d23s', NULL);
COMMIT;

-- ----------------------------
-- Table structure for user_roles
-- ----------------------------
DROP TABLE IF EXISTS `user_roles`;
CREATE TABLE `user_roles` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  `username` varchar(100) DEFAULT NULL COMMENT '用户名',
  `role_name` varchar(100) DEFAULT NULL COMMENT '角色名',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_user_roles` (`username`,`role_name`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COMMENT='用户-角色表';

-- ----------------------------
-- Records of user_roles
-- ----------------------------
BEGIN;
INSERT INTO `user_roles` VALUES (4, 'Hello123', 'superadmin');
INSERT INTO `user_roles` VALUES (5, 'myuser33', 'user');
INSERT INTO `user_roles` VALUES (1, 'u320Jk', 'admin');
INSERT INTO `user_roles` VALUES (2, 'u320Jk', 'user');
COMMIT;

-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  `username` varchar(100) DEFAULT NULL COMMENT '用户名',
  `password` varchar(100) DEFAULT NULL COMMENT '密码',
  `password_salt` varchar(100) DEFAULT NULL COMMENT '盐',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_users_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';

-- ----------------------------
-- Records of users
-- ----------------------------
BEGIN;
INSERT INTO `users` VALUES (1, 'u320Jk', 'c17972a3fde6d2c505cbe7f0b534cd84', NULL);
INSERT INTO `users` VALUES (2, 'Hello123', '05637e4f92f7e280a8bdafb4f00f3544', NULL);
INSERT INTO `users` VALUES (3, 'myuser33', '409a70a47acc74a30103775207b8f289', NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
